﻿using IS_Ever_Green.DataAccess.Model.Repositories;
using IS_Ever_Green.DataAccess.Model;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace IS_Ever_Green.ViewModel
{
    public class PhoneViewModel : BaseViewModel
    {
        private IProductRepository _productRepository;
        private ObservableCollection<ProductModel> _phoneList;
        private string _textPhone;

        public ObservableCollection<ProductModel> PhoneList
        {
            get { return _phoneList; }
            set { _phoneList = value; OnPropertyChanged(nameof(PhoneList)); }
        }

        public string TextPhone
        {
            get { return _textPhone; }
            set { _textPhone = value; OnPropertyChanged(nameof(TextPhone)); }
        }


        public ICommand AddProductCart { get; }
        public ICommand AddProductLike { get; }
        public ICommand DeleteProductCart { get; }
        public ICommand DeleteProductLike { get; }

        public PhoneViewModel()
        {
            _productRepository = new ProductRepository();

            ShowProductFromPhone();
        }

        public void ShowProductFromPhone()
        {
            PhoneList = new ObservableCollection<ProductModel>(_productRepository.GetProductWithCategory(4));
            if (PhoneList.Count != 0)
            {
                TextPhone = "Телефоны";
            }
        }
    }
}
